home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DDJ0192.ARJ / TEST.C < prev    next >
Text File  |  1991-10-08  |  4KB  |  146 lines

  1. /* --------------- memopad.c ----------- */
  2.  
  3. #include "dflat.h"
  4.  
  5. char DFlatApplication[] = "Tester";
  6.  
  7. #ifdef BCPP
  8. /* --- to bypass Borland C++ precompiled header problem --- */
  9. extern int far cdecl _setargv__;
  10. static void far *bozo = &_setargv__;
  11. #endif
  12.  
  13. char **Argv;
  14.  
  15. static int EditorProc(WINDOW, MESSAGE, PARAM, PARAM);
  16. static int ListboxProc(WINDOW, MESSAGE, PARAM, PARAM);
  17.  
  18. static WINDOW wnd, cwnd1, cwnd2;
  19.  
  20. void main(int argc, char *argv[])
  21. {
  22.     Argv = argv;
  23.     init_messages();
  24.     wnd = CreateWindow(APPLICATION,
  25.                         "D-Flat Test " VERSION,
  26.                         0, 0, -1, -1,
  27.                         NULL,
  28.                         NULL,
  29.                         NULL,
  30.                         MOVEABLE  |
  31.                         SIZEABLE  |
  32.                         HASBORDER |
  33.                         HASSTATUSBAR |
  34.                         CONTROLBOX
  35.                         );
  36.     cwnd1 = CreateWindow(EDITBOX,
  37.                         "Editbox",
  38.                         5,5,10,60,
  39.                         NULL,wnd,EditorProc,
  40.                         MOVEABLE  |
  41.                         SIZEABLE  |
  42.                         HASBORDER |
  43.                         MULTILINE |
  44.                         VSCROLLBAR
  45.                         );
  46.     cwnd2 = CreateWindow(LISTBOX,
  47.                         "Listbox",
  48.                         10,10,10,30,
  49.                         NULL,wnd,ListboxProc,
  50.                         MOVEABLE  |
  51.                         SIZEABLE  |
  52.                         HASBORDER
  53.                         );
  54.     SendMessage(cwnd1, SHOW_WINDOW, TRUE, 0);
  55.     SendMessage(cwnd2, SETFOCUS, TRUE, 0);
  56.     PutWindowLine(cwnd1,
  57.     "Now is the time for all good men to come to the aid of their party",
  58.     2,6);
  59.     while (dispatch_message())
  60.         ;
  61. }
  62.  
  63. static char *text[] = {
  64.     "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  65.     "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  66.     "cccccccccccccccccccccccccccccccccccccccccccccccccc",
  67.     "dddddddddddddddddddddddddddddddddddddddddddddddddd",
  68.     "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  69.     "ffffffffffffffffffffffffffffffffffffffffffffffffff",
  70.     "gggggggggggggggggggggggggggggggggggggggggggggggggg",
  71.     "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh",
  72.     "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",
  73.     "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj",
  74.     "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
  75.     "llllllllllllllllllllllllllllllllllllllllllllllllll",
  76.     "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
  77.     "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
  78.     "oooooooooooooooooooooooooooooooooooooooooooooooooo",
  79.     "pppppppppppppppppppppppppppppppppppppppppppppppppp",
  80.     "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",
  81.     "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr",
  82.     "ssssssssssssssssssssssssssssssssssssssssssssssssss",
  83.     "tttttttttttttttttttttttttttttttttttttttttttttttttt",
  84.     "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu",
  85.     "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv",
  86.     "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
  87.     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  88.     "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
  89.     "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
  90.     NULL
  91. };
  92.  
  93. static int ListboxProc(WINDOW wnd,MESSAGE msg,PARAM p1,PARAM p2)
  94. {
  95.     char **cp = text;
  96.     int rtn;
  97.     switch (msg)    {
  98.         case CREATE_WINDOW:
  99.             rtn = DefaultWndProc(wnd, msg, p1, p2);
  100.             while (*cp)
  101.                 SendMessage(wnd, ADDTEXT, (PARAM) *cp++, 0);
  102.             return rtn;
  103.         case KEYBOARD:
  104.             if ((int)p1 == UP)
  105.                 SendMessage(cwnd1, SCROLL, TRUE, 0);
  106.             else if ((int)p1 == DN)
  107.                 SendMessage(cwnd1, SCROLL, FALSE, 0);
  108.             break;
  109.         default:
  110.             break;
  111.     }
  112.     return DefaultWndProc(wnd, msg, p1, p2);
  113. }
  114.  
  115. static int EditorProc(WINDOW wnd,MESSAGE msg,PARAM p1,PARAM p2)
  116. {
  117.     int rtn;
  118.     switch (msg)    {
  119.         case SETFOCUS:
  120.             if ((int)p1)    {
  121.                 char **cp = text;
  122.                 SendMessage(wnd, CLEARTEXT, 0, 0);
  123.                 while (*cp)
  124.                     SendMessage(wnd, ADDTEXT, (PARAM) *cp++, 0);
  125.             }
  126.             break;
  127.         default:
  128.             break;
  129.     }
  130.     return DefaultWndProc(wnd, msg, p1, p2);
  131. }
  132.  
  133. void PrepFileMenu(void *w, struct Menu *mnu)
  134. {
  135. }
  136.  
  137. void PrepSearchMenu(void *w, struct Menu *mnu)
  138. {
  139. }
  140.  
  141. void PrepEditMenu(void *w, struct Menu *mnu)
  142. {
  143. }
  144.  
  145.  
  146.